package at.jku.ssw.fortress.ui;

import java.util.ResourceBundle;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

import at.jku.ssw.fortress.util.ColorManager;
import at.jku.ssw.fortress.util.ImageManager;

/**
 * The activator class controls the plug-in life cycle
 */
public class FortressPlugin extends AbstractUIPlugin {

	// The plug-in ID
	public static final String PLUGIN_ID = "at.jku.ssw.fortress.ui";

	public static final String FORTRESS_HOME_PREF = "fortressHomePref";

	// The shared instance
	private static FortressPlugin plugin;
	
	/**
	 * The constructor
	 */
	public FortressPlugin() {
		plugin = this;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	/**
	 * Returns the shared instance
	 * 
	 * @return the shared instance
	 */
	public static FortressPlugin getDefault() {
		return plugin;
	}
	
	private ResourceBundle resourceBundle;

	public ResourceBundle getResourceBundle() {
		if (resourceBundle == null) {
			resourceBundle = ResourceBundle.getBundle("at.jku.ssw.fortress.ui.Editor");
		}
		return resourceBundle;
	}
	
	@Override
	protected void initializeDefaultPluginPreferences() {
		super.initializeDefaultPluginPreferences();
	}
	
	private ImageManager imageManager = new ImageManager();
	
	public ImageManager getImageManager() {
		return imageManager;
	}
	
	private ColorManager colorManager = new ColorManager();
	
	public ColorManager getColorManager() {
		return colorManager;
	}

}
